<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>我的直播间</title>
    <style>
        *{margin: 0;padding: 0}
        .gift{
            width: 800px;
            height: 100px;
            position: fixed;
            bottom: 10px;
            left: calc((100% - 800px) / 2);
            border-radius: 10px;
            /*来点阴影*/
            box-shadow: 0 0 10px rgba(0,0,0,0.5);
            /*来点阴影*/
            background-color: rgba(255,255,255,0.8);
        }
        .gift-png{
            width: 80px;
            height: 80px;
            margin-top: 10px;
            float: left;
            margin-left: 10px;
            cursor: pointer;
            background-size: 100% 100%;
            border-radius: 20px;
        }
        .hj{
            background-image: url("./img/hj.png");
        }
        .hj:hover{
            background-image: url("./img/hj-dh.webp");
        }
        .fj{
            background-image: url("./img/fj.png");
        }
        .fj:hover{
            background-image: url("./img/fj-dh.webp");
        }
    </style>
</head>
<body>
    <div class="gift">
        <div class="gift-png hj"></div>
        <div class="gift-png fj"></div>
    </div>
</body>
<script>
    /*写一个礼物飘过的效果*/
    var ws = new WebSocket("/gift/榜一大哥");
    //ws四种状态
    ws.onopen = function(){
        console.log("连接成功");
    }
    ws.onclose = function(){
        console.log("连接关闭");
    }
    ws.onmessage = function(e){
        console.log(e.data);
    }
    ws.onerror = function(e){
        console.log(e);
    }
</script>
</html>